/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package PCR;

import java.awt.GridLayout;
import popups.PopupFrameManager;

/**
 *
 * @author icdev
 */
public class ShapesDialog extends javax.swing.JDialog {

    /**
     * Creates new form ShapesDialog
     */
    
    public ShapesDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();

    }

    public void loadShapes(String shapeType) {
        PopupFrameManager popupDisplayer = new PopupFrameManager();
        if (shapeType.equals("Band")) {
            GridLayout gLayout = new GridLayout(popupDisplayer.getBandsModel().getRowCount() / 2, popupDisplayer.getBandsModel().getRowCount() / 2);
            jPanel1.setLayout(gLayout);
            popupDisplayer.getBands(this.jPanel1, true);
        } else if (shapeType.equals("Smear")) {
            GridLayout gLayout = new GridLayout(popupDisplayer.getSmearsModel().getRowCount() / 2, popupDisplayer.getSmearsModel().getRowCount() / 2);
            jPanel1.setLayout(gLayout);
            popupDisplayer.getSmears(this.jPanel1, true);
        } else if (shapeType.equals("Dimer")) {
            GridLayout gLayout = new GridLayout(popupDisplayer.getDimersModel().getRowCount() / 2, popupDisplayer.getDimersModel().getRowCount() / 2);
            jPanel1.setLayout(gLayout);
            popupDisplayer.getDimers(this.jPanel1, true);
        } else if (shapeType.equals("Housekeeping")) {
            GridLayout gLayout = new GridLayout(popupDisplayer.getHouseKeepingsModel().getRowCount() / 2, popupDisplayer.getHouseKeepingsModel().getRowCount() / 2);
            jPanel1.setLayout(gLayout);
            popupDisplayer.getHouseKeepings(this.jPanel1, true);
        }
    }
    
    static boolean replacer;
    static{replacer=false;}
    
    public static void setReplacer(boolean rep)
    {
        replacer=rep;
    }

    public static boolean isReplacer()
    {
        return replacer;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 398, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 224, Short.MAX_VALUE)
        );

        jScrollPane1.setViewportView(jPanel1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 341, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
        replacer = false;
    }//GEN-LAST:event_formWindowClosing

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
}
